import request from '@/utils/request'

// 查询列表
export function listTask(query) {
  return request({
    url: '/kyhs/task-plan/select-in-page',
    method: 'get',
    params:{
      page:query.pageNum,
      pageSize:query.pageSize,
      ticketName:query.ticketName,
      ticketNum:query.ticketNum
    }
  })
}

// 查询详细
export function getTask(ticketNum) {
  return request({
    url: '/kyhs/task-plan/select-detail-by-num',
    method: 'get',
    params:{
      ticketNum:ticketNum
    }
  })
}

export function addTask(data) {
  return request({
    url: '/kyhs/task-plan/save',
    method: 'post',
    data: data
  })
}

// 修改
export function updateTask(data) {
  return request({
    url: '/kyhs/task-plan/update',
    method: 'put',
    data:data
  })
}

// 删除
export function delTask(ticketNum) {
  return request({
    url: '/kyhs/task-plan/delete-by-num',
    method: 'delete',
    params:{
      ticketNum:ticketNum
    }
  })
}

//撤回
export function getback(id) {
  return request({
    url: '/kyhs/task-plan/withdraw',
    method: 'put',
    params:{
      id:id
    }
  })
}

//下达
export function putoff(id) {
  return request({
    url: '/kyhs/task-plan/issued',
    method: 'put',
    params:{
      id:id
    }
  })
}

export function putnew(data) {
  return request({
    url: '/kyhs/task-plan/issued-with-save',
    method: 'post',
    data: data
  })
}
